QuickTime 4 API Documentation

3D Graphics Programming with QuickDraw 3D 1.5.4

Previous | QD3D Book | Overview | Chapter Contents | Next |

Using Illumination Shaders

You create an illumination shader by calling the _New function for the type of illumination model you want to use. For example, to use Phong illumination, you can call the Q3PhongIllumination_New function.

Once you've created an illumination shader, you apply it to the objects in a model by submitting the shader inside of a submitting loop, or by adding it to a group that is submitted in a submitting loop. For instance, to apply Phong illumination to all the objects in a model, you can call the function Q3Shader_Submit in your rendering loop, as shown in Listing 4 .

Listing 4 Applying an illumination shader

Q3View_StartRendering(myView);
do {
    Q3Shader_Submit(myPhongShader, myView);

    /*submit styles, groups, and other objects here*/

    myViewStatus = Q3View_EndRendering(myView);
} while (myViewStatus == kQ3ViewStatusRetraverse);

© 1997 Apple Computer, Inc.

Previous | QD3D Book | Overview | Chapter Contents | Next |